home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 3 / Gold Medal Software - Volume 3 (Gold Medal) (1994).iso / wordproc / wf_v31c.arj / DOCS / WF.C < prev    next >
Text File  |  1992-01-31  |  49KB  |  998 lines

  1. .f3                              - # -              Appendix C - Examples & Tips
  2. .rm70
  3. .tc
  4. .tc C. EXAMPLES & TIPS ....................................#
  5. APPENDIX C   EXAMPLES & TIPS
  6.  
  7. .irTIPS;   see also Appendix C
  8. This appendix consists of examples of various Word Fugue features.
  9. They are in addition to the examples distributed throughout the
  10. manual, and in the tutorial. The examples are intended to give you
  11. ideas for using Word Fugue in your own work or to help you with a
  12. particular application. Because Word Fugue users often have questions
  13. relating to merge printing, many of these examples are related to
  14. merge printing applications.
  15.  
  16. .tc    Changing Page Length and Line Height ...............#
  17. Changing Page Length and Line Height
  18.  
  19. Suppose you are printing a document for readers with visual
  20. impairment. You plan to use double width characters on paper that is
  21. 14 inches long. You also plan to increase the line height in order to
  22. increase the separation between lines.
  23.  
  24. By default, Word Fugue assumes that you are using American standard
  25. 8½-by-11-inch paper with 6 lines of text to the inch. This example
  26. shows you how to set up a document for paper 14 lines long, with 4
  27. lines per inch.
  28.  
  29. First, you must tell Word fugue of the new page length. At the default
  30. of 6 lines per inch, 14 inch paper is 6 * 14 = 84 lines. So in order
  31. to tell Word Fugue that you are using 14 inch paper, use the .PL
  32. command to set the page length to 84.
  33.  
  34.         .PL 84
  35.  
  36. Now, use the .LH command to set the appropriate line height, and Word
  37. Fugue will calculate the correct number of lines per page at this
  38. height. You must have set the page length first, or Word Fugue will
  39. assume that you are using 66 line paper. The default line step is
  40. measured in 1/48ths of an inch - if your printer does not use this,
  41. then you must determine the appropriate step and number. At 4 lines
  42. per inch, you need 12/48ths of an inch per line:
  43.  
  44.         .LH 12    
  45.         .LH 18/72            if your printer uses 1/72nds of an inch
  46.         .LH 54/216           if your printer uses 1/216ths of an inch
  47.  
  48. Word Fugue will calculate the new number of lines that will fit on a
  49. page - 84/12*8 = 56 lines. (Or 14*4 = 56!). Subtract of the margins
  50. from the new page length to determine how many lines in the text body:
  51. 56-5-4=47. Thus there will be 47 text lines to the page. (Please note
  52. that this is not a figure for the .PL command.)
  53.  
  54. If you are using double width characters, you should change the right
  55. margin to 33 to fit on the line (.RM33) and you should change the page
  56. offset to 5 (.PO5) since these are measured in characters.
  57.  
  58. .CP10
  59. .tc    Double Spaced Text .................................#
  60. Double Spaced Text
  61. .ixDouble;Double Spaced Text (.LH)
  62.  
  63. If you need to print text double spaced, you actually want to print 3
  64. lines per inch instead of the normal 6. You do this by changing the
  65. line height. At 6 lines per inch, the line height was 8/48 inches. To
  66. print 3 lines per inch, you need to double the line spacing to 16/48
  67. inches:
  68.  
  69.         .LH 16
  70.  
  71. Again, you should place this command at the top of your text.
  72.  
  73. .CP6
  74. .tc    Selective Printing of Page Numbers .................#
  75. Selective Printing of Page Numbers
  76.  
  77. If you are printing a manual such as this, you probably do not want
  78. page numbers on the title page, you want to use lower case roman
  79. numerals for the table of contents, and ordinary numbers starting from
  80. one at the first page of the first chapter. The following example
  81. shows you how to do this.
  82.  
  83.  
  84.    ┌─────────────────────────────────────────────────────────────────┐
  85.    │            .po10                                                │
  86.    │            .rm70                                                │
  87.    │            .mt5                                                 │
  88.    │            .mb4                                                 │
  89.    │            .pl66                                                │
  90.    │                                                                 │
  91.    │                 Word Fugue                                      │
  92.    │                                                                 │
  93.    │                 User's Guide                                    │
  94.    │                                                                 │
  95.    │            .pa                                                  │
  96.    │            --------------------- (page break) ---------------   │
  97.    │            .H1        WORD FUGUE USERS GUIDE                    │
  98.    │            .H2        TABLE OF CONTENTS                         │
  99.    │            .h3 ──────────────────────────────────────────────   │
  100.    │            .PA                                                  │
  101.    │            .f1                                                  │
  102.    │            .f2 ──────────────────────────────────────────────   │
  103.    │            .f3               - # -                              │
  104.    │ A ─────────.pn1                                                 │
  105.    │ B ─────────.pt r                                                │
  106.    │ C ─────────.fiwf.toc  contains the text for table of contents   │
  107.    │            .pa                                                  │
  108.    │            --------------------- (page break) ---------------   │
  109.    │            .H1        WORD FUGUE USERS GUIDE                    │
  110.    │            .h2 ──────────────────────────────────────────────   │
  111.    │ D ─────────.H3                                                  │
  112.    │ E ─────────.pn1                                                 │
  113.    │ F ─────────.pt n                                                │
  114.    │                                                                 │
  115.    │                        [Text]                                   │
  116.    │                                                                 │
  117.    └─────────────────────────────────────────────────────────────────┘
  118.  
  119.  
  120.  
  121. For the sample book on the previous page, printing starts without page
  122. numbers on the title page. (This is the default, so the .OP command is
  123. not needed). The .PA command starts a new page for the table of
  124. contents. The footing with the # will cause page numbers to be printed
  125. from then on. However, the first page of the table of contents is
  126. physically the second page of the document, and Word Fugue will have
  127. set the page number to 2. Thus the line labelled A (.PN1) resets the
  128. page number to 1 for the table of contents.
  129.  
  130. We want lowercase roman Numerals for the contents, so line B (.PT r)
  131. will set page numbers to be printed in lower case roman numerals. The
  132. table of contents is held in a separate file WF.TOC and so is copied
  133. in using the .FI file include command at line C.
  134.  
  135. At the end of the table of contents we take a new page and change the
  136. heading. Line D blanks heading line 3. Line E resets the page number
  137. back to 1 again for the first chapter. Line F changes the page number
  138. type back to ordinary numbers.
  139.  
  140. .tc    Printing the First Page on Letterhead ..............#
  141. Printing the First Page of a Document on Letterhead
  142.  
  143. This is the format for the first page of an organisation's formal
  144. correspondence on preprinted letterhead.
  145.  
  146.  
  147.       ┌────────────────────────────────────────────────────────────┐
  148.       │                                                            │
  149.       │ ..STATIONARY FORMAT                                        │
  150.       │ ..FIRST PAGE                                               │
  151.       │ .RRL    !        !       !       !                   R     │
  152.       │ .MT10                                                      │
  153.       │ .MB5                                                       │
  154.       │ .PO14                                                      │
  155.       │                                           {.@D8}           │
  156.       └────────────────────────────────────────────────────────────┘
  157.  
  158. The large top margin of 10 accommodates the preprinted letterhead. The
  159. {.@D8} causes the current date to be printed in the format dd month
  160. yyyy.
  161.  
  162. The letter should should be printed with Manual Paper Feed turned on
  163. to cause the print to pause between pages so you can swap paper for
  164. the following pages (unless you have a sheet feeder for your printer)
  165. The example below shows how to print the rest of the letter.
  166.  
  167.  
  168.       ┌────────────────────────────────────────────────────────────┐
  169.       │                                                            │
  170.       │ ..FOLLOWING PAGES                                          │
  171.       │ .MT5                                                       │
  172.       │ .MB4                                                       │
  173.       │ .PG                                                        │
  174.       │ .PC 1                                                      │
  175.       │                                                            │
  176.       └────────────────────────────────────────────────────────────┘
  177.  
  178.  
  179. .CP6
  180. The .PG command turns on printing of page numbers in the default
  181. column at the foot of the page. The .PC 1 places the page number in
  182. column 1.
  183.  
  184.     TIP You could set up this format (or your own variation) as a
  185.     separate document, and whenever you want to print such a letter,
  186.     use the file read command (Ctrl K R) to insert the document into
  187.     the letter.
  188.  
  189. .cp10
  190. .tc    Printing a Standard Business Envelope ..............#
  191. Printing a Standard Business Envelope
  192.  
  193. Assuming your printer can handle envelopes, then to print one you need
  194. only consider it as a document with a short page length and special
  195. margins.
  196.  
  197. The format shown below is suitable for a standard 9½-by-4-inch
  198. business envelope, printing 10 characters per inch.
  199.  
  200.  
  201.        ┌───────────────────────────────────────────────────────────┐
  202.        │                                                           │
  203.        │ .PA             {begin envelope on new page}              │
  204.        │ .PL24           {standard size @ 6 lines per inch}        │
  205.        │ .MT12           {start printing 12 lines from top}        │
  206.        │ .MB0            {eliminate bottom margin}                 │
  207.        │ .PO40           {begin printing 40 spaces from left edge} │
  208.        │                                                           │
  209.        └───────────────────────────────────────────────────────────┘
  210.  
  211. If you use different size envelopes, change the dot commands
  212. accordingly.
  213.  
  214.     TIP You could set up this format (or your own variation) as a
  215.     separate document, and whenever you want to print an envelope,
  216.     use the file read command (Ctrl K R) to insert the format into
  217.     the document.
  218.  
  219. .tc    A Typical Master Document for Merge Printing .......#
  220. A Typical Master Document for Merge Printing
  221.  
  222. The following is a sample master document for a form letter that
  223. includes variable names and merge print dot commands:
  224.  
  225. .CP21
  226.      ┌──────────────────────────────────────────────────────────┐
  227.      │  .df names.dat                                           │
  228.      │  .rv name,greeting,address1,address2                     │
  229.      │  ..make sure that there is enough room for letterhead    │
  230.      │  .mt 20                                                  │
  231.      │                                                          │
  232.      │  {.D8}                                                   │
  233.      │                                                          │
  234.      │  &name&                                                  │
  235.      │  &address1&                                              │
  236.      │  &address2&                                              │
  237.      │                                                          │
  238.      │  Dear &greeting&,                                        │
  239.      │                                                          │
  240.      │  thank you for your recent enquiry. ........             │
  241.      │                                                          │
  242.      │  yours sincerely                                         │
  243.      │                                                          │
  244.      │  fred Nurk                                               │
  245.      │  .pa                                                     │
  246.      └──────────────────────────────────────────────────────────┘
  247.  
  248. The four variables in the form letter are surrounded by ampersands (&).
  249. The date in NAMES.DAT might look like this:
  250.  
  251.  
  252. .ixData Files;   examples
  253.      ┌───────────────────────────────────────────────────────────┐
  254.      │  Joe Bloggs,Mr. Bloggs,43 Oak drive,Acorn city  SA 5871   │
  255.      │  Jane Smith,Ms Smith,7 Main St,The Village   TAS 7766     │
  256.      │  Cecil Cedric,Cecil,9 Rose ave, Melbourne   VIC   3021    │
  257.      └───────────────────────────────────────────────────────────┘
  258.  
  259.  
  260. .tc    Merge Printing Envelopes for a Mass Mailing ........#
  261. Merge Printing Envelopes for a Mass Mailing
  262.  
  263. You can use the same data file from the letters to print the
  264. envelopes. However, you will need to create a different master
  265. document. Below is an example of such a document:
  266.  
  267.  
  268.     ┌──────────────────────────────────────────────────────────────┐
  269.     │.df names.dat                                                 │
  270.     │.rv name,greeting,address1,address2                           │
  271.     │.av "Put an envelope in the printer. Press enter when ready",X│
  272.     │.pl24                                                         │
  273.     │.mt12                                                         │
  274.     │.mb0                                                          │
  275.     │.po40                                                         │
  276.     │&name&                                                        │
  277.     │&address1&                                                    │
  278.     │&address2&                                                    │
  279.     │.pa                                                           │
  280.     └──────────────────────────────────────────────────────────────┘
  281.  
  282.  
  283. The dot commands select the data file, read the data, and interrupt
  284. printing so you can put in a new envelope. They also set up the format
  285. for a standard envelope as above.
  286.  
  287. The .AV tells word Fugue to pause during the merge printing and
  288. display the message in quotes. The X variable in the .AV command is
  289. used only because the .AV command requires a variable for the keyboard
  290. input. Using the .AV is really only a trick to display a message and
  291. pause until you press Enter.
  292.  
  293. The next 4 dot commands set up the format for the envelope - the page
  294. length, top and bottom margins, and offset.
  295.  
  296. The address variables print the name and address from the data file.
  297. The .PA starts a new envelope.
  298.  
  299. .cp40
  300. .tc    Merge Printing Sticky Labels Three Across ..........#
  301. Merge Printing Sticky Labels Three Across
  302. {.╬}
  303. Example 1{.╬}
  304. .tc       Example 1 .......................................#
  305.  
  306. This first example shows you how to set up a format for merge printing
  307. names and addresses on stick labels. The dot commands here assume
  308. standard 3½-inch by 1½-inch labels, printed at 10 characters per inch
  309. and 6 lines per inch. Each label can therefore fit 35 characters.
  310.  
  311.  
  312.     ┌──────────────────────────────────────────────────────────────┐
  313.     │ .po 2                                                        │
  314.     │ .PL 9                                                        │
  315.     │ .mt 1                                                        │
  316.     │ .mb 1                                                        │
  317.     │ .df label.dat                                                │
  318.     │ .rv name1,address1,city1,state1,pc1                          │
  319.     │ .rv name2,address2,city2,state2,pc2                          │
  320.     │ .rv name3,address3,city3,state3,pc3                          │
  321.     │ .sv name1/L30=&name1&                                        │
  322.     │ .sv name2/L30=&name2&                                        │
  323.     │ .sv name3/L30=&name3&                                        │
  324.     │ .sv address1/L30=&address1&                                  │
  325.     │ .sv address2/L30=&address2&                                  │
  326.     │ .sv address3/L30=&address3&                                  │
  327.     │ .sv cityline1/L30=&city1&, &state1&, &pc1&                   │
  328.     │ .sv cityline2/L30=&city2&, &state2&, &pc2&                   │
  329.     │ .sv cityline3/L30=&city3&, &state3&, &pc3&                   │
  330.     │ &name1&     &name2&     &name3&                              │
  331.     │ &address1&     &address2&     &address3&                     │
  332.     │ &cityline1&     &cityline2&     &cityline3&                  │
  333.     │ .pa                                                          │
  334.     └──────────────────────────────────────────────────────────────┘
  335.  
  336.  
  337. Each row of labels is treated as a page, so the page length is set to
  338. 9 lines (6 lines per inch => 1½" = 9 lines). The data for each label
  339. is read in, and then formatted.
  340.  
  341. The .SV lines format each variable to a length of 30 characters, left
  342. justified. We could have defined formats for the variables City, State
  343. and PC, so that their combined length totalled 30 characters, but the
  344. method shown here of creating another variable is easier to work with.
  345.  
  346. .CP6
  347. There are 6 spaces between each variable reference in the print
  348. section. During merge printing, each variable is replaced with a
  349. field 30 characters wide. The five spaces between them add up to a
  350. combined width of 36 characters, which is the label width plus the gap
  351. between the labels. The point of the .PO2 command is to ensure that
  352. the text does not start right on the edge of the label (which would
  353. look unsightly).
  354.  
  355. The .PL9 command also tells the printer the page length, so it does
  356. not matter whether you have form feeds on or not. However, if your
  357. printer does not have a control sequence for setting page length, you
  358. should turn off form feeds before printing (otherwise the printer will
  359. spit out 66 lines for each label!).
  360. {.╬}
  361. {.╬}
  362. Example 2{.╬}
  363. .tc       Example 2 .......................................#
  364.  
  365. This second example shows you how to achieve the same ends but by
  366. using snaking columns of text. You can either print down one column,
  367. and then down the second and finally down the third (suitable if you
  368. have a page printer - see example 3 below) or you can print across the
  369. paper 3 abreast. This is more suitable for a dot matrix or similar
  370. with continuous stationery.{.╬}
  371.  
  372. This example is probably easier than the first, since you do not need
  373. to pad variables out to a fixed size, nor do you need to position the
  374. variables for label 2 and 3 across the page from label 1.
  375.                                                         {.╬}
  376.  
  377.     ┌──────────────────────────────────────────────────────────────┐
  378.     │ .po 2                                                        │
  379.     │ .PL 9                                                        │
  380.     │ .mt 1                                                        │
  381.     │ .mb 1                                                        │
  382.     │ .co 3,1 / 35,35,35                                           │
  383.     │ .df label.dat                                                │
  384.     │ .rv name1,address1,city1,state1,pc1                          │
  385.     │ .rv name2,address2,city2,state2,pc2                          │
  386.     │ .rv name3,address3,city3,state3,pc3                          │
  387.     │ &name1&                                                      │
  388.     │ &address1&                                                   │
  389.     │ &city1&   &state1&  &pc1&                                    │
  390.     │ .cb                                                          │
  391.     │ &name2&                                                      │
  392.     │ &address2&                                                   │
  393.     │ &city2&   &state2&  &pc2&                                    │
  394.     │ .cb                                                          │
  395.     │ &name3&                                                      │
  396.     │ &address3&                                                   │
  397.     │ &city3&   &state3&  &pc3&                                    │
  398.     │ .pa                                                          │
  399.     └──────────────────────────────────────────────────────────────┘
  400.  
  401.  
  402. Each row of labels is treated as a page, so the page length is set to
  403. 9 lines (6 lines per inch => 1½" = 9 lines). The data for each label
  404. is read in. No additional formatting is done.{.╬}
  405. {.╬}
  406. The .CO line defines the printing to occur in 3 columns, with a gutter
  407. of 1 character between each column. Each column is defined to be 35
  408. characters wide. These add up to 36 characters, which allows for the
  409. gap between the labels. (Normally only 1 character).
  410.  
  411. The .CB commands after the first 2 labels issue a Column Break and
  412. cause the text following to be printed in the next column. The third
  413. label is followed by a page break (.PA) so that the 3 labels will
  414. print, and then the printer will advance to the top of the next page
  415. (the next label group).{.╬}
  416. {.╬}
  417. .cp10{.╬}
  418. Example 3{.╬}
  419. .tc       Example 3 .......................................#
  420. {.╬}
  421. When working with page printers, you should define the page to be the
  422. real page length, with margins to ensure that the printable area
  423. includes only the sticky label area. Instead of defining a single row
  424. of labels, you will need to define additional rows for the entire
  425. page, preferably using method 2. You would insert a column break at
  426. the last label in each of columns 1 and 2, with a page break after the
  427. labels in column 3. If you have 7 labels down a column, then you will
  428. need to define 3x7 = 21 labels in your page layout. If you don't do
  429. this, but try to define the labels with a page length of 9, you
  430. printer will probably spit out a page of labels with only the first
  431. row printed.{.╬}
  432. {.╬}
  433. After each label, you will need to insert sufficient blank lines to
  434. bring the next label down to where it will line up correctly. For
  435. example, if you are printing 3 lines on a label, you will need 6 blank
  436. lines to bring the format down to the next label (the length is 9
  437. lines remember?)  You can either insert column breaks after each
  438. label, so the printing will run across the page, or you can simply let
  439. them run down the column, and let Word Fugue continue in the next
  440. column when the first is full. {.╬}
  441. {.╬}
  442.  
  443. .CP29
  444.     ┌──────────────────────────────────────────────────────────────┐
  445.     │ .po 2                                                        │
  446.     │ .PL 66                                                       │
  447.     │ .mt 1                                                        │
  448.     │ .mb 2                                                        │
  449.     │ .co 3,1 / 35,35,35                                           │
  450.     │ .df label.dat                                                │
  451.     │ .rv name1,address1,city1,state1,pc1                          │
  452.     │ .rv name2,address2,city2,state2,pc2                          │
  453.     │       {this continues for 21 labels}                         │
  454.     │ .rv name21,address21,city21,state21,pc21                     │
  455.     │ &name1&                                                      │
  456.     │ &address1&                                                   │
  457.     │ &city1&   &state1&  &pc1&                                    │
  458.     │                                                              │
  459.     │                                                              │
  460.     │                          {6 blank lines to fill out label}   │
  461.     │                                                              │
  462.     │                                                              │
  463.     │ &name2&                                                      │
  464.     │                          {repeats for 21 labels}             │
  465.     │                                                              │
  466.     │                                                              │
  467.     │ &name21&                                                     │
  468.     │ &address21&                                                  │
  469.     │ &city21&   &state21&  &pc21&                                 │
  470.     │ .pa                   {prints the page and starts a new one} │
  471.     └──────────────────────────────────────────────────────────────┘
  472. {.╬}
  473.  
  474. .CP10
  475. Missing Data in Some Records
  476. .tc       Missing Data in Some Records ....................#
  477.  
  478. It may well be that in a row of labels, some may be missing the first
  479. line of the address. This is still a valid address, but can look
  480. unsightly. This is easily fixed by use of conditional dot commands.
  481. This example assumes that the mailing list consists of name, street
  482. address and city line, and that the street address is missing.
  483.  
  484. After Word Fugue has read all variables from the data file for a row
  485. of labels, it can check to see if any street addresses are missing.
  486. The method we will use is to place the name into the street line, and
  487. blank out the name:
  488.  
  489.  
  490.     ┌────────────────────────────────────────────────────┐
  491.     │    .IF &ADDRESS1&=                                 │
  492.     │    .SV ADDRESS1=&NAME1&                            │
  493.     │    .SV NAME1/L30=                                  │
  494.     │    .EI                                             │
  495.     │    .IF &ADDRESS2&=                                 │
  496.     │    .SV ADDRESS2=&NAME2&                            │
  497.     │    .SV NAME2/L30=                                  │
  498.     │    .EI                                             │
  499.     │    .IF &ADDRESS3&=                                 │
  500.     │    .SV ADDRESS3=&NAME3&                            │
  501.     │    .SV NAME3/L30=                                  │
  502.     │    .EI                                             │
  503.     └────────────────────────────────────────────────────┘
  504.  
  505.  
  506. You  can modify this basic procedure to cater for other situations
  507. where data could be missing.
  508.  
  509. .tc    Merging and Centering a Variable in a Page .........#
  510. Merging and Centring a Variable in a Page
  511.  
  512. To centre a variable in a document page, simply use the .SV command,
  513. and specify the format as /C for centred, with the width the same as
  514. the ruler line.
  515.  
  516.         .RV name
  517.         .SV name/C70=&name&
  518.  
  519. will define name as 70 characters wide (the same as the ruler line),
  520. and centre the value read. Simply place the variable at the left
  521. margin of your document, and the text will be centred on the page.
  522.  
  523. .tc    Maths, Formatting and Conditionals in Merging ......#
  524. Maths, Formatting and Conditionals in Merging
  525.  
  526. The example on the next page shows how to set up a more complicated
  527. document, which is only printed if the customer spent a total of more
  528. than $40 during the last month, on at least 4 different items. A
  529. special discount is offered, 5% for those who spent less than $400,
  530. and 10% for those who spent more.
  531.  
  532. .pa
  533.         .df names.dat
  534.         .rv first,last,street,city,state,postcode
  535.         .rv item1,price1,item2,price2,item3,price3,item4,price4
  536. A       .ma total$=&price1&+&price2&+&price3&+&price4&
  537. B       .sv total/R10=&total&
  538. C ────┬ .sv item1/L25=&item1&
  539.       │ .sv item2/L25=&item2&
  540.       │ .sv item3/L25=&item3&
  541.       └ .sv item4/L25=&item4&
  542. D ────┬ .sv price1/R17=&price1&
  543.       │ .sv price2/R17=&price2&
  544.       │ .sv price3/R17=&price3&
  545.       └ .sv price4/R17=&price4&
  546. E  ┌─── .if &total& >= 40.00
  547. F ─│────────────────────                {.@D8}
  548.    │    Nurk's Special Supplies
  549.    │    Erehwon
  550.    │
  551.    │    &First& &Last&
  552. G ─│─┌─ .if &street&
  553.    │ │  &street&
  554.    │ └─ .ei
  555.    │    &city& &state& &postcode&
  556.    │
  557.    │    Dear &First&
  558.    │
  559.    │    Our records show that you have bought four or more items from
  560.    │    us in the last month.......
  561.    │    ... we are offering you the following discount on your next
  562.    │    purchase:
  563.    │
  564. H ─│─┌─ .if &total& < 400.00
  565.    │ │                  five percent
  566.    │ ├  .el
  567.    │ │                  ten percent
  568.    │ └─ .ei
  569.    │
  570. I ─│─┌─ .if &item2&
  571.    │ │  Here list a list of your last purchases
  572.    │ ├  .el
  573.    │ │  Here is your last purchase
  574.    │ └─ .ei
  575.    │
  576. J ─│──┬         &item1&&price1&
  577.    │  │         &item2&&price2&
  578.    │  │         &item3&&price3&
  579.    │  └         &item4&&price4&
  580.    │
  581.    │            Total                           &total&
  582.    │
  583.    │    sincerely
  584.    │
  585.    │    Fred Nurk
  586.    │    .pa
  587.    └─── .ei
  588.  
  589. .CP5
  590.   Explanation
  591.  
  592.   At A, the total is calculated from the four prices read in, and is
  593.   formatted as 2 decimal places (the $ at the end of total does this).
  594.  
  595.   Line B formats the total to be 10 characters wide, right justified.
  596.  
  597.   Lines C format the item descriptions to be 25 characters wide, left
  598.   justified.
  599.  
  600.   Lines D format the prices to be 17 characters wide, right justified.
  601.  
  602.   Line E checks that the total expenditure is greater than or equal to
  603.   40. If it is less, the entire letter is skipped down to the matching
  604.   .EI, which means that nothing prints.
  605.  
  606.   Line F inserts todays date in the format dd month yyyy.
  607.  
  608.   Lines marked G test if the variable street contains a value, and
  609.   prints it if it does. If the variable is blank, the line is omitted.
  610.  
  611.   The lines labelled H print the words five percent if the total is
  612.   less than 400, and print the words ten percent otherwise.
  613.  
  614.   The lines marked with I test if there is a second item, and print
  615.   the words here is a list of your last purchases if there is a second
  616.   item, but print the words Here is your last purchase if there is
  617.   not a second item.
  618.  
  619.   The lines J print a list of items, they have already been
  620.   formatted, so there is no need for spaces between the variable
  621.   names, the formatting takes care of that. The first ampersand (&) of
  622.   the total is in the column so that it will line up with the other
  623.   prices when they print.
  624.  
  625.   NOTE if you need to omit variables from your data file, place a blank
  626.        and follow it by a comma (,). Each .RV command only reads
  627.        variables from one line of the file
  628.  
  629. .tc    Advanced Mathematics in Merge Printing .............#
  630. Advanced Mathematics in Merge Printing
  631.  
  632. All of the functions of Word Fugue's pop up calculator are available
  633. for the .MA command. You can do complicated trigonometric functions and
  634. so on. For example to calculate loan payments from the amount
  635. borrowed, interest rate and term of loan is:
  636.  
  637.        P = A * i * (i + 1)n/((i+1)n-1)
  638.  
  639. where P is the amount of each payment
  640.       A is the amount borrowed
  641.       i is the interest rate per payment interval. If the payment
  642.         interval is monthly, divide i by 12. i must be converted from
  643.         a percentage to a decimal fraction - 12% = 0.12, and on
  644.         monthly payments = 0.01
  645.       n is the total number of payments. For example monthly payments
  646.         over 4 years total 48 payments
  647.  
  648. .CP5
  649. This equation can be expressed in a .MA commands below. The actual
  650. equation is on one line only - since Word Fugue's maximum line length
  651. is 999 characters, you should be able to express the most complicated
  652. equation on one line. If you cannot, break it up into parts, calculate
  653. intermediate values, and then combine the intermediate values.
  654.  
  655.       ┌────────────────────────────────────────────┐
  656.       │ .. calculate monthly interest as decimal   │
  657.       │ .MA i=&interest&/1200                      │
  658.       │ .. calculate payment P                     │
  659.       │ .MA P$=&A&*&i&*(&i&+1)^&n&/((&i&+1)^&n&-1) │
  660.       └────────────────────────────────────────────┘
  661.  
  662. The hat sign (^) is used for raising the first number to the power of
  663. the second, thus 2 squared (22) is 2^2, and 2 cubed (23) is 2^3. The
  664. variable interest is read in as a percentage and then divided by 1200
  665. to convert it to a decimal rate per month. It is more efficient to
  666. calculate i once and refer to it in the second equation than to
  667. calculate it each time it is referenced (3 times), and probably less
  668. confusing too. The payment figure is truncated to 2 decimal places for
  669. printing as a Dollar amount. Without this, Word Fugue might print the
  670. payment figure as a 14 digit decimal number, depending on just how
  671. many decimal places the exponentiation (raising to the nth power)
  672. produced.
  673.  
  674. .tc    Creating a Lookup Table for Merge Printing .........#
  675. Creating a Lookup Table for Merge Printing
  676.  
  677. There can be times when, for example, you want to print different
  678. messages for different categories of people. Either you do not want to
  679. type the same message in over and over again, or you want to use a
  680. standard mailing list several times for several different sets of
  681. messages.
  682.  
  683. You could read in the customer type, and use conditionals (.IF .EL
  684. .EI) to determine the message to be printed, but there is another
  685. method, using what is known as recursion:
  686.  
  687. In your sample data file there are 3 records:
  688.  
  689.        ┌───────────────────────────────────┐
  690.        │Fred Nurk,&prize1&                 │
  691.        │Susan Soo,&prize2&                 │
  692.        │Sally Zed,&Prize2&                 │
  693.        └───────────────────────────────────┘
  694.  
  695. .CP16
  696. The form letter looks like this:
  697.  
  698.        ┌──────────────────────────────────────────────┐
  699.        │.sv prize1=A new car                          │
  700.        │.sv prize2=A trip to New Zealand for 2        │
  701.        │.df data.dat                                  │
  702.        │.rv name,prize                                │
  703.        │Dear &name&                                   │
  704.        │                                              │
  705.        │Your prize is &prize&                         │
  706.        │                                              │
  707.        │sincerely yours                               │
  708.        │prize coordinator                             │
  709.        │.pa                                           │
  710.        │                                              │
  711.        └──────────────────────────────────────────────┘
  712.  
  713. When the variable prize is read from the data file, it will contain
  714. either "&prize1&" or "&prize2&". When it is printed, it will be
  715. replaced with the characters it contains, and since they have been
  716. defined as variables themselves, they in turn will be replaced with "A
  717. new car" and "A trip to New Zealand for 2" respectively.
  718.  
  719. .tc    Proof Reading Your Printouts Before Merge Printing .#
  720. Proof Reading Your Printouts Before Merge Printing
  721.  
  722. Keep in mind that when merging documents with data files, everything
  723. has to be correct. Take your time to spell check your documents, proof
  724. read them carefully. In addition, you should try out the different
  725. combinations (especially if you are using conditionals) by using a
  726. sample data file before the real thing.
  727.  
  728. You can either run this to paper, or print it to disk and review the
  729. output using Word Fugue. If your document is large, you could make an
  730. exact copy of it, and working on the copy, delete most of the text,
  731. leaving just enough to identify the various conditions and so on. Run
  732. this with your sample data file to see how things work.
  733.  
  734. This approach is ideal for developing a merge print document - work
  735. out the commands you need to use, and test them with a sample data
  736. file, then when you have fixed any errors in the commands, flesh out
  737. the document with the real text, and print it again with the sample
  738. data file. Be sure to try each of the different combination so that
  739. you know you won't have funny merged documents in some situations.
  740. Only when you are sure that everything is right should you run the
  741. real print.
  742.  
  743. .cp15
  744. .tc    Working with Books and Chapters ....................#
  745. Working with Books and Chapters
  746. .tc       The Master Document .............................#
  747. {.╬}
  748. The Master Document{.╬}
  749.  
  750. For convenience, you should break a long document such as a book or a
  751. research paper down into sections or chapters. Each chapter should be
  752. set up as a separate file. To simplify printing, generation of table
  753. of contents and indexes, you should create a Master Document that
  754. includes each chapter using a .FI command. With the master document
  755. loaded into Word Fugue, you can easily open a chapter by placing the
  756. cursor on the appropriate .FI line and pressing Ctrl F to load the
  757. chapter into a separate window.
  758.  
  759. If you inspect the compressed document file that came with your copy
  760. of Word Fugue, you will find that it contains a version of the manual
  761. you are reading. The master document is WF.DOC, and all the chapters
  762. are WF.nnn, where nnn is a number or letter. The table of contents is
  763. WF.TOC, while the index is WF.IDX. They are generated by specifying
  764. WF.DOC as the file to process, and each chapter is included as needed
  765. by the .FI command.
  766.  
  767. Below is a section of the master document:
  768. {.╬}
  769.  
  770.          ┌──────────────────────────────────────────────────────┐
  771. A ─────┬─│.po O 12                                              │
  772.        └─│.po E 8                                               │
  773.          │                                                      │
  774.          │               Word Fugue                             │
  775.          │                                                      │
  776.          │               User's Guide                           │
  777.          │                                                      │
  778.          │.pa                                                   │
  779. B ─────┬─│.f1                                                   │
  780.        ├─│.f2 ──────────────────────────────────────────────────│
  781.        └─│.f3                                 - # -             │
  782. C ─────┬─│.pn1                                                  │
  783.        └─│.pt r                                                 │
  784. D ───────│.fiwf.toc                                             │
  785.        ┌─│.pa                                                   │
  786. E ─────┼─│.H1                      WORD FUGUE USERS GUIDE       │
  787.        ├─│.h2 ──────────────────────────────────────────────────│
  788.        └─│.H3                                                   │
  789. F ─────┬─│.pn1                                                  │
  790.        └─│.pt n                                                 │
  791. G ─────┬─│.fiwf.001                                             │
  792. H ──┬──│─│.pbo                                                  │
  793.     │  ├─│.fiwf.002                                             │
  794.     ├──│─│.pbo                                                  │
  795.     │  ├─│.fiwf.003                                             │
  796.     ├──│─│.pbo                                                  │
  797.     │  └─│.fiwf.004                                             │
  798.     ├────│.pbo                                                  │
  799.          └──────────────────────────────────────────────────────┘
  800.  
  801. .cp7
  802.  
  803. A - The page offset for even numbered pages is set to 8 characters,
  804.     while that for odd numbered pages is set to 12 characters. This is
  805.     to allow for the binding, since the book will eventually be
  806.     printed double sided, with the left hand pages bearing even
  807.     numbers, and the right hand pages bearing odd numbers.
  808.  
  809. B   A three line footer is created, with the page number as the lowest
  810.     line.
  811.  
  812. C   The page number is reset to 1 via the .PN 1 line, while the type
  813.     of the page number is set to lower case roman numerals via the
  814.     .PTr command.
  815.  
  816. D   The table of contents is included.
  817.  
  818. E   A new page is started, and a heading is set up for the entire
  819.     document.
  820.  
  821. F   The page number is reset to 1, and the number type is changed to
  822.     ordinary numbers via the .PT n command. Failure to reset the page
  823.     number to 1 will result in the first page being numbered 4 or 5 as
  824.     it follows the table of contents.
  825.  
  826. G   These lines include the first 4 chapters of the manual.
  827.  
  828. H   These lines ensure that each new chapter starts on an ODD numbered
  829.     page. If the next page is even numbered, a blank page will be
  830.     printed to force the text onto an odd numbered page.
  831.  
  832. There are many more commands in the real master document, and it is
  833. suggested that you inspect the sample documents to see how everything
  834. is done.
  835.  
  836. Headings in your Table of Contents
  837. .tc       Headings in your Table of Contents ..............#
  838.  
  839. Since the table of contents is generated each time, and headings etc
  840. need to be placed into the table of contents when it is generated.
  841. This can be accomplished by prefixing the dot commands by .TC, since
  842. the text that follows the dot command is copied literally into the
  843. table of contents file.
  844.  
  845. For example, the following commands in a document:
  846.  
  847.  
  848.        ┌───────────────────────────────────────┐
  849.        │.TC.HE   TABLE OF CONTENTS             │
  850.        │.TC.FO       - # -                     │
  851.        │.TC.PT r                               │
  852.        │.TC CHAPTER 1 ...................#     │
  853.        │.tc    sub heading 1 ............#     │
  854.        │.tc    sub heading 2 ............#     │
  855.        │.tc                                    │
  856.        │.tc CHAPTER 2 ...................#     │
  857.        └───────────────────────────────────────┘
  858.  
  859. .cp17
  860. will produce a table of contents file (.TOC) containing:
  861.  
  862.  
  863.        ┌───────────────────────────────────────┐
  864.        │.HE   TABLE OF CONTENTS                │
  865.        │.FO       - # -                        │
  866.        │.PT r                                  │
  867.        │ CHAPTER 1 ...................1        │
  868.        │    sub heading 1 ............1        │
  869.        │    sub heading 2 ............2        │
  870.        │                                       │
  871.        │ CHAPTER 2 ...................4        │
  872.        └───────────────────────────────────────┘
  873.  
  874.  
  875. A blank line can be produced by typing a .TC command with no text
  876. following.
  877. {.╬}
  878. Headings and Columns in your Index
  879. .tc       Headings and Columns in your Index ..............#
  880.  
  881. Since the index is generated each time, and headings etc need to be
  882. placed into the table of contents when it is generated. This can be
  883. accomplished by prefixing the dot commands by .IR, since the text that
  884. follows the dot command is copied literally into the table of contents
  885. file. For commands to come at the start of the index, you would use a
  886. prefix of .IR ; (the major sort key is a space to sort to the front).
  887. For dot commands to appear at the end, you would use .IR■; (the major
  888. sort key is ■ which can be keyed in by holding down the ALT key and
  889. pressing 254 on the numeric key pad. This character will sort last).
  890. For dot commands to appear at a particular point (or headings), you
  891. would use the prefix .IRabcde; where abcde is what ever sequence of
  892. characters that will cause that line to sort into the appropriate
  893. place.{.╬}
  894.  
  895. For example, the following commands in a document:{.╬}
  896.  
  897.  
  898.        ┌───────────────────────────────────────┐{.╬}
  899. #1 ──┬─│.IR ;.HE       INDEX                   │{.╬}
  900.      │ │.IR ;.FO       - # -                   │{.╬}
  901.      │ │.IR ;.PT r                             │{.╬}
  902.      └─│.IR ;.PN 1                             │{.╬}
  903. #2 ────│.IR!;.CO 2,5                           │{.╬}
  904. #3 ────│.IR■;.CO 1                             │{.╬}
  905. #4 ──┬─│.IRA;  ^O                              │{.╬}
  906.      │ │.irA;  -A-                             │{.╬}
  907.      └─│.IRA;  {.|·}                               │{.╬}
  908.        │.IRB;  ^O                              │{.╬}
  909.        │.irB;  -B-                             │{.╬}
  910.        │.IRB;  {.|·}                               │{.╬}
  911.        │.IMAardvarks                           │{.╬}
  912.        │.ix   Eating Habits                    │{.╬}
  913.        │.ix   Habitat                          │{.╬}
  914.        │.ix   As pets                          │{.╬}
  915.        │.IMBirds                               │{.╬}
  916.        │.ix   As pets                          │{.╬}
  917.        └───────────────────────────────────────┘{.╬}
  918.  
  919. .cp17
  920.  
  921. will produce an index file (.IDX) containing:
  922.  
  923.  
  924.        ┌───────────────────────────────────────┐{.╬}
  925.        │.FO       - # -                        │{.╬}
  926.        │.HE       INDEX                        │{.╬}
  927.        │.PN 1                                  │{.╬}
  928.        │.PT r                                  │{.╬}
  929.        │.CO 2,5                                │{.╬}
  930.        │                                       │{.╬}
  931.        │  -A-                                  │{.╬}
  932.        │                                       │{.╬}
  933.        │Aardvarks                              │{.╬}
  934.        │   As pets        1                    │{.╬}
  935.        │   Eating Habits  5-9                  │{.╬}
  936.        │   Habitat        3-5                  │{.╬}
  937.        │                                       │{.╬}
  938.        │  -B-                                  │{.╬}
  939.        │                                       │{.╬}
  940.        │Birds                                  │{.╬}
  941.        │   As pets                             │{.╬}
  942.        │.CO 1                                  │{.╬}
  943.        └───────────────────────────────────────┘{.╬}
  944.  
  945.  
  946. A blank line can be produced by typing a .IR command with no text
  947. following.{.╬}
  948. {.╬}
  949. This will print the index in 2 columns, with 5 spaces between the
  950. columns. The major sort key specified for the lines numbered #1 is a
  951. space (any characters following a .IR or .IX and preceded by a ;
  952. (semicolon) are the sort key for that line. If none is specified, the
  953. the previous .IM text is used) and so the 4 lines will sort together.
  954. The text on each line will also be sorted, so the .FO will come before
  955. the .HE line.
  956.  
  957. The major sort key specified for the line numbered #2 is an
  958. exclamation mark (!) which will sort immediately after a space. This
  959. is so the .CO 2,5 (snaking column of text) will be sorted to the front
  960. of the file, but after the header and footer commands. The key for
  961. line #3 is ■ and so the .CO 1 line (end snaking columns) will sort to
  962. the end of the file. You should be aware that since you have used a
  963. space and exclamation mark as major sort keys, all the major sort keys
  964. for you index entries CANNOT have a preceding space, but must start
  965. hard up against the .IM command (eg .IMAardvarks). If you do not
  966. follow this rule, then those entries will sort among the header lines,
  967. which you do not want to happen. Its not an unmitigated disaster, but
  968. your index will not print the way you want.{.╬}
  969. {.╬}
  970. The three lines numbered #4 all have a major sort key of A, so they
  971. will all sort together, and the text after the (;) will appear in
  972. sorted order. The first line contains the text ^O - this is actually a
  973. non breaking space, and is entered by pressing Ctrl P O. It will sort
  974. before a space, but will always print as a space. (You could also use
  975. this as the sort key for head & footer lines if you want your major
  976. index entries to have leading spaces). The letter A by itself will
  977. always sort before any combination of letters starting with A.
  978.  
  979. The last of the three lines contains a ({.|·}) character, which is
  980. actually a pad character. It will sort after all letters, numbers and
  981. special characters, but before (■). You enter it by holding down the
  982. ALT key and typing 250 on the numeric key pad. This ensures that the
  983. space line will sort after the -A- line. (If you used ^O again, the 2
  984. space lines would sort before the -A- line). {.╬}
  985. {.╬}
  986. .RRL    w  !       !       !       !       !       !       !       !    R
  987. NOTE The ^O and the ({.|·}) character MUST either physically line up with
  988.      the first non space character on the intervening lines or must be
  989.      in an earlier column IF you want them to sort in the right order.
  990.      If you were to set them in (say) 3 characters, then the first 3
  991.      characters would be spaces. If the heading had only 2 spaces
  992.      preceding it (-A-) then it would sort AFTER the other 2 lines,
  993.      because the third character (-) will come alphabetically after a
  994.      space.
  995.  
  996. .RRL       !       !       !       !       !       !       !       !    R
  997.  
  998.